﻿@model IEnumerable<KRM.Core.vCustomerDetailsOnOrder>
@{
    ViewBag.Title = "Order search";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div class="box">
                <div class="box-title">
                    <h3>Order search</h3>
                </div>
                <fieldset>
                    <legend>Quick search</legend>
                    @Html.Partial("Partial/_MessageResult")
                    <form action="/orderview/orderdetail" class="form-inline span3 nomargin" target="_blank">
                        <input  id="OrderRef" name="OrderRef" class="input-medium" type="text" placeholder="Order Ref" required="required">
                        <button type="submit" class="btn btn-primary">Go</button>
                    </form>
                    <form action="/orderview/orderdetail" class="form-inline span3 nomargin" target="_blank">
                        <input name="tradeorderref" class="input-medium" type="text" placeholder="Trade OrderRef" required="required">
                        <button type="submit" class="btn btn-primary">Go</button>
                    </form>
                    <form action="/orderview/orderdetail" class="form-inline span3 nomargin" target="_blank">
                        <input name="TempNumber" class="input-medium" type="text" placeholder="Temp Number" required="required">
                        <button type="submit" class="btn btn-primary">Go</button>
                    </form>
                </fieldset>
                <div class="fieldset">
                    <div class="legend"><span>Search</span></div>
                    <div class="row-fluid">
                        <form class="span6 nomargin" action="/orderview/search" method="POST" style="margin-bottom: 30px">
                            <div class="span6">
                                <div class="row-fluid">
                                    <div class="span4">Postcode</div>
                                    <div class="span8">
                                        <input type="text" name="postcode" style="width: 80%;" />
                                    </div>
                                </div>
                                <div class="row-fluid">
                                    <div class="span4">Surname</div>
                                    <div class="span8">
                                        <input type="text" name="surname" style="width: 80%;" />
                                    </div>
                                </div>
                                <div class="row-fluid">
                                    <div class="span4">
                                        <input type="checkbox" checked="checked" name="max100" class="pull-right" disabled="disabled" />
                                    </div>
                                    <div class="span8">Max 100 results</div>
                                </div>
                            </div>
                            <div class="span6">
                                <div class="row-fluid">
                                    <div class="span4">Phone</div>
                                    <div class="span8">
                                        <input type="text" name="phone" style="width: 80%;" />
                                    </div>
                                </div>
                                <div class="row-fluid">
                                    <div class="span4">Email</div>
                                    <div class="span8">
                                        <input type="text" name="email" style="width: 80%;" />
                                    </div>
                                </div>
                                <div class="row-fluid">
                                    <div class="span4"></div>
                                    <div class="span8">
                                        <div class="span8">
                                            <input type="submit" value="Search" class="btn btn-primary" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                        @*<fieldset class="span2 nomargin">
                            <legend>Trade order search</legend>
                            <input type="text" name="tradeorder" style="width: 89%" />
                            <input type="submit" value="Search" class="btn btn-primary" />
                        </fieldset>
                        <fieldset class="span2 nomargin">
                            <legend>Google order search</legend>
                            <input type="text" name="tradeorder" style="width: 89%" />
                            <input type="submit" value="Search" class="btn btn-primary" />
                        </fieldset>
                        <fieldset class="span2 nomargin">
                            <legend>Woolworths search</legend>
                            <input type="text" name="tradeorder" style="width: 89%" />
                            <input type="submit" value="Search" class="btn btn-primary" />
                        </fieldset>*@
                    </div>
                    @if (Model != null)
                    {
                        <div class="customerdetailsonorder">
                            <table class="table table-hover table-bordered table-fix krmtable" data-height="350">
                                <thead>
                                    <tr>
                                        <th>OrderRef</th>
                                        <th>OrderValue</th>
                                        <th>DatePlaced</th>
                                        <th>CustomerID</th>
                                        <th>Email</th>
                                        <th>Title</th>
                                        <th>FirstName</th>
                                        <th>Surname</th>
                                        <th>Postcode</th>
                                        <th>Town</th>
                                        <th>Country</th>
                                        <th>Detail</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach (var item in Model)
                                    {
                                        <tr>
                                            <td><a href="/orderview/orderdetail?orderref=@item.OrderRef">@item.OrderRef</a></td>
                                            <td>@item.OrderValue</td>
                                            <td>@item.DatePlaced</td>
                                            <td>@item.CustomerID</td>
                                            <td>@item.EmailAddress</td>
                                            <td>@item.Title</td>
                                            <td>@item.Forename</td>
                                            <td>@item.Surname</td>
                                            <td>@item.Postcode</td>
                                            <td>@item.Town</td>
                                            <td>@item.County</td>
                                            <td>
                                                <a href="/orderview/orderdetail?orderref=@item.OrderRef">Detail</a>
                                            </td>
                                        </tr>
                                    }
                                </tbody>
                            </table>
                        </div>
                    }
                </div>
            </div>
        </div>
    </div>
</div>